package com.geekstudy.week11.config;


import com.geekstudy.week11.runner.HelloWorldApplicationRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;

@Configuration
public class WorkConfiguration {

    final Logger logger = LoggerFactory.getLogger(WorkConfiguration.class);

    @Bean
    public ApplicationRunner applicationRunner() {
        logger.info("applicationRunner");
        ApplicationRunner applicationRunner = new ApplicationRunner() {

            final Logger logger = LoggerFactory.getLogger("customerApplicationRunner");

            @Override
            public void run(ApplicationArguments args) throws Exception {
                logger.info(" args:{}", Arrays.toString(args.getSourceArgs()));
            }
        };

        return applicationRunner;
    }

    @Bean
    public ApplicationRunner helloWorldApplicationRunner() {
        logger.info("helloWorldApplicationRunner");
        ApplicationRunner applicationRunner = new HelloWorldApplicationRunner();
        return applicationRunner;
    }
}
